#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdkhooks>
#include <left4dhooks>


public Plugin myinfo = 
{
	name = "l4d2_skip_tank_taunt_only",
	author = "sorallll",
	description = "坦克跳过嘲讽拍胸动作.",
	version = "1.0.1",
	url = "https://forums.alliedmods.net/showthread.php?t=336707"
}

public void OnClientPutInServer(int client)
{
	AnimHookEnable(client, OnTankAnimPre);
}

/**
* 跳过以下Tank嘲讽动画:
* ACT_TERROR_HULK_VICTORY 		792
* ACT_TERROR_HULK_VICTORY_B 	793
* ACT_TERROR_RAGE_AT_ENEMY 		794
* ACT_TERROR_RAGE_AT_KNOCKDOWN	795
**/
Action OnTankAnimPre(int client, int &anim)
{
	if(GetClientTeam(client) != 3 || 
		!IsPlayerAlive(client) || 
		GetEntProp(client, Prop_Send, "m_zombieClass") != 8 || 
		GetEntProp(client, Prop_Send, "m_isGhost") == 1)
	{
		return Plugin_Continue;
	}

	if(792 <= anim <= 795)
	{
		anim = 0; // 设置为空动画
		SetEntPropFloat(client, Prop_Send, "m_flCycle", 1000.0); // 立即完成动画
		return Plugin_Changed;
	}

	return Plugin_Continue;
}